package com.itany.corejava.code07_面向对象.lianxi;

import java.util.Scanner;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月03日 9:42
 */
public class Cats {
    private Cat[] cats;
    public Cats(){
        //提示用户输入猫的数量
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入您想要的猫的数量:");
        int num=sc.nextInt();
        cats=new Cat[num];
        String[] colors={"黄色","白色","黑色","黄白色"};
        String[] kinds={"短毛猫","布偶猫","波斯猫","田园猫"};
        for(int i=0;i<num;i++){
            int index1=(int)(Math.random()*4);
            int index2=(int)(Math.random()*4);
            Cat cat=new Cat("猫"+(i+1),colors[index1],kinds[index2]);
            cats[i]=cat;
        }


    }
    public void setCats(Cat[] cats){
        this.cats=cats;
    }
    public Cat[] getCats(){
        return cats;
    }

}
